using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace QuanLyHocPhi.Model.Mapping
{
    public class NguoiSuDungMap : EntityTypeConfiguration<NguoiSuDung>
    {
        public NguoiSuDungMap()
        {
            // Primary Key
            this.HasKey(t => t.TenDangNhap);

            // Properties
            this.Property(t => t.TenDangNhap)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.HoTen)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.MatKhau)
                .IsRequired()
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("NguoiSuDung");
            this.Property(t => t.TenDangNhap).HasColumnName("TenDangNhap");
            this.Property(t => t.HoTen).HasColumnName("HoTen");
            this.Property(t => t.MatKhau).HasColumnName("MatKhau");
            this.Property(t => t.VaiTro).HasColumnName("VaiTro");
        }
    }
}
